package library;

import java.util.Set;
import java.util.TreeSet;


class MusicAlbum
	extends Item
{
	private String title;
	private String band;
	private int nSongs;
	private Set<String> keywords;
	private Set<String> members;
	
	public MusicAlbum(String title, String band, int nSongs, String... keywords){
		this.title = title;
		this.band = band;
		this.nSongs = nSongs;
		this.keywords = new TreeSet<String>();
		this.keywords.clear();
		for(String s: keywords){
			this.keywords.add(s);
		}
	}

	public String getTitle(){
		return this.title;
	}
	
	public String getCreator() {
		return this.band;
	}

	public Set<String> getGroup() {
		return this.members;
	}

	public Set<String> getKeyword() {
		return this.keywords;
	}
	
	public String toString(){
		String result;
		result = "-Music Album-\r\n";
		result += "band:     " + this.band + "\r\n# songs:  " + this.nSongs + "\r\n";
		
		result += "members:  ";
		boolean flag = false;
		for(String s: members){
			if (flag == false){
				result += s;
				flag = true;
			}
			else{
				result += ", " + s;
			}
		}
		
		result += "\r\ntitle:    " + this.title + "\r\nkeywords: ";
		
		flag = false;
		for(String s: keywords){
			if (flag == false){
				result += s;
				flag = true;
			}
			else{
				result += ", " + s;
			}
		}
		result += "\r\n";
		return result;
	}
	
	public void add(String... M) {
		this.members = new TreeSet<String>();
		this.members.clear();
		for(String m: M){
			this.members.add(m);
		}
	}

	
	
}
